package com.model.user;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;

import com.core.utils.LocalizableString;


@Entity
public class UserCategory {

	private UserGroup userGroup;
	private UserRole  userRole;

	private Integer   id;



	@Id
	@TableGenerator(name = "generatorUserCategory", table = "Generators", pkColumnName = "generatorName", pkColumnValue = "generatorUserCategory", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "generatorUserCategory")
	public Integer getId () {

		return id;
	}



	public void setId ( Integer id ) {

		this.id = id;
	}



	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(nullable = true, updatable = true)
	public UserGroup getUserGroup () {

		return userGroup;
	}



	public void setUserGroup ( UserGroup userGroup ) {

		this.userGroup = userGroup;
	}



	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(nullable = true, updatable = true)
	public UserRole getUserRole () {

		return userRole;
	}



	public void setUserRole ( UserRole userRole ) {

		this.userRole = userRole;
	}



	public String localizableDescription () {

		return LocalizableString.sharedInstance().localizable("entity.UserCategory.description");
	}

}
